-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Ignore exception on cancel/fail race in CancellableContinuation #896
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
common/kotlinx-coroutines-core-common/src/CancellableContinuationImpl.kt
Outdated
Show resolved
Hide resolved
common/kotlinx-coroutines-core-common/src/CancellableContinuationImpl.kt
Show resolved
Hide resolved
common/kotlinx-coroutines-core-common/src/CancellableContinuationImpl.kt
Outdated
Show resolved
Hide resolved
common/kotlinx-coroutines-core-common/src/CancellableContinuationImpl.kt
Outdated
Show resolved
Hide resolved
common/kotlinx-coroutines-core-common/src/CancellableContinuationImpl.kt
Outdated
Show resolved
Hide resolved
common/kotlinx-coroutines-core-common/src/CancellableContinuationImpl.kt
Outdated
Show resolved
Hide resolved
common/kotlinx-coroutines-core-common/src/CancellableContinuationImpl.kt
Show resolved
Hide resolved
There seems to be no other way to satisfactory fix the problem of a race between cancellation on CancellationContinuation and concurrent failure of the corresponding background process in a way the distinguishes "failure from cancellation attempt" from a "true failure" without placing undue burden on anyone who is implementing `await()` extension function for various future types. - Added testTimeoutCancellationFailRace that works as a perfect litmus test; being allowed to run for a while it reliably detects various problems in alternative approaches. - Optimized CancellableContinuationImpl; merged its code with AbstractContinuation class that is not needed as a separate class and removed. - Deprecated and hidden CancellableContinuation.initCancellability(); it is now always invoked after the end of the block that was passed to suspendCancellableCoroutine. - Deprecated `holdCancellability` parameter to an internal suspendAtomicCancellableCoroutine function. Fixes #892 Fixes #830
2b86b09
to
4ad776f
Compare
All review issues were addressed. |
Are there any estimates about release date with this fix? |
@gildor 1.1.0-alpha today or tomorrow and 1.1.0 on Friday if everything goes well |
@qwwdfsad Great news, just in time, I just didn't want to release kotlin-coroutines-retrofit with workaround that uses internal API. |
There seems to be no other way to satisfactory fix the problem of a race between cancellation on CancellationContinuation and concurrent failure of the corresponding background process in a way the distinguishes "failure from cancellation attempt" from a "true failure" without placing undue burden on anyone who is implementing
await()
extension function for various future types.holdCancellability
parameter to an internal suspendAtomicCancellableCoroutine function.Fixes #892
Fixes #830